// $ANTLR 3.4 C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g 2012-01-25 11:23:48

//  package com.yagi;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;

import org.antlr.runtime.tree.*;


@SuppressWarnings({"all", "warnings", "unchecked"})
public class YAGIParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "COMMENT", "ID", "INT", "STRING", "WHITESPACE", "'!='", "'$'", "'('", "')'", "'+'", "'+='", "','", "'-'", "'-='", "';'", "'<'", "'<='", "'='", "'=='", "'>'", "'>='", "'['", "']'", "'action'", "'all'", "'and'", "'choose'", "'do'", "'effect:'", "'else'", "'end action'", "'end choose'", "'end for'", "'end if'", "'end pick'", "'end proc'", "'exists'", "'fact'", "'false'", "'fluent'", "'for'", "'from'", "'if'", "'in'", "'local'", "'not'", "'or'", "'pick'", "'precondition:'", "'proc'", "'signal:'", "'such'", "'test'", "'then'", "'true'", "'{'", "'}'"
    };

    public static final int EOF=-1;
    public static final int T__9=9;
    public static final int T__10=10;
    public static final int T__11=11;
    public static final int T__12=12;
    public static final int T__13=13;
    public static final int T__14=14;
    public static final int T__15=15;
    public static final int T__16=16;
    public static final int T__17=17;
    public static final int T__18=18;
    public static final int T__19=19;
    public static final int T__20=20;
    public static final int T__21=21;
    public static final int T__22=22;
    public static final int T__23=23;
    public static final int T__24=24;
    public static final int T__25=25;
    public static final int T__26=26;
    public static final int T__27=27;
    public static final int T__28=28;
    public static final int T__29=29;
    public static final int T__30=30;
    public static final int T__31=31;
    public static final int T__32=32;
    public static final int T__33=33;
    public static final int T__34=34;
    public static final int T__35=35;
    public static final int T__36=36;
    public static final int T__37=37;
    public static final int T__38=38;
    public static final int T__39=39;
    public static final int T__40=40;
    public static final int T__41=41;
    public static final int T__42=42;
    public static final int T__43=43;
    public static final int T__44=44;
    public static final int T__45=45;
    public static final int T__46=46;
    public static final int T__47=47;
    public static final int T__48=48;
    public static final int T__49=49;
    public static final int T__50=50;
    public static final int T__51=51;
    public static final int T__52=52;
    public static final int T__53=53;
    public static final int T__54=54;
    public static final int T__55=55;
    public static final int T__56=56;
    public static final int T__57=57;
    public static final int T__58=58;
    public static final int T__59=59;
    public static final int T__60=60;
    public static final int COMMENT=4;
    public static final int ID=5;
    public static final int INT=6;
    public static final int STRING=7;
    public static final int WHITESPACE=8;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public YAGIParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public YAGIParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

protected TreeAdaptor adaptor = new CommonTreeAdaptor();

public void setTreeAdaptor(TreeAdaptor adaptor) {
    this.adaptor = adaptor;
}
public TreeAdaptor getTreeAdaptor() {
    return adaptor;
}
    public String[] getTokenNames() { return YAGIParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g"; }


    public static class line_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "line"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:16:1: line : ( declaration | block );
    public final YAGIParser.line_return line() throws RecognitionException {
        YAGIParser.line_return retval = new YAGIParser.line_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        YAGIParser.declaration_return declaration1 =null;

        YAGIParser.block_return block2 =null;



        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:16:6: ( declaration | block )
            int alt1=2;
            switch ( input.LA(1) ) {
            case 10:
            case 27:
            case 41:
            case 43:
            case 53:
                {
                alt1=1;
                }
                break;
            case ID:
                {
                int LA1_5 = input.LA(2);

                if ( (synpred1_YAGI()) ) {
                    alt1=1;
                }
                else if ( (true) ) {
                    alt1=2;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 1, 5, input);

                    throw nvae;

                }
                }
                break;
            case 44:
                {
                int LA1_7 = input.LA(2);

                if ( (synpred1_YAGI()) ) {
                    alt1=1;
                }
                else if ( (true) ) {
                    alt1=2;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 1, 7, input);

                    throw nvae;

                }
                }
                break;
            case 46:
                {
                int LA1_8 = input.LA(2);

                if ( (synpred1_YAGI()) ) {
                    alt1=1;
                }
                else if ( (true) ) {
                    alt1=2;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 1, 8, input);

                    throw nvae;

                }
                }
                break;
            case EOF:
            case 30:
            case 51:
            case 56:
                {
                alt1=2;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 1, 0, input);

                throw nvae;

            }

            switch (alt1) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:16:8: declaration
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_declaration_in_line59);
                    declaration1=declaration();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, declaration1.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:17:5: block
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_block_in_line66);
                    block2=block();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, block2.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "line"


    public static class declaration_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "declaration"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:21:1: declaration : ( fluent_decl ';' | fact_decl ';' | action_decl | proc_decl | assignment );
    public final YAGIParser.declaration_return declaration() throws RecognitionException {
        YAGIParser.declaration_return retval = new YAGIParser.declaration_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token char_literal4=null;
        Token char_literal6=null;
        YAGIParser.fluent_decl_return fluent_decl3 =null;

        YAGIParser.fact_decl_return fact_decl5 =null;

        YAGIParser.action_decl_return action_decl7 =null;

        YAGIParser.proc_decl_return proc_decl8 =null;

        YAGIParser.assignment_return assignment9 =null;


        CommonTree char_literal4_tree=null;
        CommonTree char_literal6_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:22:2: ( fluent_decl ';' | fact_decl ';' | action_decl | proc_decl | assignment )
            int alt2=5;
            switch ( input.LA(1) ) {
            case 43:
                {
                alt2=1;
                }
                break;
            case 41:
                {
                alt2=2;
                }
                break;
            case 27:
                {
                alt2=3;
                }
                break;
            case 53:
                {
                alt2=4;
                }
                break;
            case ID:
            case 10:
            case 44:
            case 46:
                {
                alt2=5;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;

            }

            switch (alt2) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:22:4: fluent_decl ';'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_fluent_decl_in_declaration78);
                    fluent_decl3=fluent_decl();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, fluent_decl3.getTree());

                    char_literal4=(Token)match(input,18,FOLLOW_18_in_declaration80); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal4_tree = 
                    (CommonTree)adaptor.create(char_literal4)
                    ;
                    adaptor.addChild(root_0, char_literal4_tree);
                    }

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:23:4: fact_decl ';'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_fact_decl_in_declaration85);
                    fact_decl5=fact_decl();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, fact_decl5.getTree());

                    char_literal6=(Token)match(input,18,FOLLOW_18_in_declaration87); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal6_tree = 
                    (CommonTree)adaptor.create(char_literal6)
                    ;
                    adaptor.addChild(root_0, char_literal6_tree);
                    }

                    }
                    break;
                case 3 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:24:4: action_decl
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_action_decl_in_declaration92);
                    action_decl7=action_decl();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, action_decl7.getTree());

                    }
                    break;
                case 4 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:25:5: proc_decl
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_proc_decl_in_declaration98);
                    proc_decl8=proc_decl();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, proc_decl8.getTree());

                    }
                    break;
                case 5 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:26:4: assignment
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_assignment_in_declaration103);
                    assignment9=assignment();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment9.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "declaration"


    public static class proc_decl_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "proc_decl"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:32:1: proc_decl : 'proc' ID '(' varlist ')' block 'end proc' ;
    public final YAGIParser.proc_decl_return proc_decl() throws RecognitionException {
        YAGIParser.proc_decl_return retval = new YAGIParser.proc_decl_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal10=null;
        Token ID11=null;
        Token char_literal12=null;
        Token char_literal14=null;
        Token string_literal16=null;
        YAGIParser.varlist_return varlist13 =null;

        YAGIParser.block_return block15 =null;


        CommonTree string_literal10_tree=null;
        CommonTree ID11_tree=null;
        CommonTree char_literal12_tree=null;
        CommonTree char_literal14_tree=null;
        CommonTree string_literal16_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:33:2: ( 'proc' ID '(' varlist ')' block 'end proc' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:33:4: 'proc' ID '(' varlist ')' block 'end proc'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal10=(Token)match(input,53,FOLLOW_53_in_proc_decl118); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal10_tree = 
            (CommonTree)adaptor.create(string_literal10)
            ;
            adaptor.addChild(root_0, string_literal10_tree);
            }

            ID11=(Token)match(input,ID,FOLLOW_ID_in_proc_decl120); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID11_tree = 
            (CommonTree)adaptor.create(ID11)
            ;
            adaptor.addChild(root_0, ID11_tree);
            }

            char_literal12=(Token)match(input,11,FOLLOW_11_in_proc_decl122); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal12_tree = 
            (CommonTree)adaptor.create(char_literal12)
            ;
            adaptor.addChild(root_0, char_literal12_tree);
            }

            pushFollow(FOLLOW_varlist_in_proc_decl124);
            varlist13=varlist();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, varlist13.getTree());

            char_literal14=(Token)match(input,12,FOLLOW_12_in_proc_decl126); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal14_tree = 
            (CommonTree)adaptor.create(char_literal14)
            ;
            adaptor.addChild(root_0, char_literal14_tree);
            }

            pushFollow(FOLLOW_block_in_proc_decl128);
            block15=block();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, block15.getTree());

            string_literal16=(Token)match(input,39,FOLLOW_39_in_proc_decl130); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal16_tree = 
            (CommonTree)adaptor.create(string_literal16)
            ;
            adaptor.addChild(root_0, string_literal16_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "proc_decl"


    public static class block_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "block"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:38:1: block : ( statement )* ;
    public final YAGIParser.block_return block() throws RecognitionException {
        YAGIParser.block_return retval = new YAGIParser.block_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        YAGIParser.statement_return statement17 =null;



        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:39:2: ( ( statement )* )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:39:4: ( statement )*
            {
            root_0 = (CommonTree)adaptor.nil();


            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:39:4: ( statement )*
            loop3:
            do {
                int alt3=2;
                int LA3_0 = input.LA(1);

                if ( (LA3_0==ID||LA3_0==30||LA3_0==44||LA3_0==46||LA3_0==51||LA3_0==56) ) {
                    alt3=1;
                }


                switch (alt3) {
            	case 1 :
            	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:39:5: statement
            	    {
            	    pushFollow(FOLLOW_statement_in_block144);
            	    statement17=statement();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, statement17.getTree());

            	    }
            	    break;

            	default :
            	    break loop3;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "block"


    public static class statement_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "statement"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:42:1: statement : ( action_exec ';' | pick | test ';' | for_loop | if_then_else | choose );
    public final YAGIParser.statement_return statement() throws RecognitionException {
        YAGIParser.statement_return retval = new YAGIParser.statement_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token char_literal19=null;
        Token char_literal22=null;
        YAGIParser.action_exec_return action_exec18 =null;

        YAGIParser.pick_return pick20 =null;

        YAGIParser.test_return test21 =null;

        YAGIParser.for_loop_return for_loop23 =null;

        YAGIParser.if_then_else_return if_then_else24 =null;

        YAGIParser.choose_return choose25 =null;


        CommonTree char_literal19_tree=null;
        CommonTree char_literal22_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:43:2: ( action_exec ';' | pick | test ';' | for_loop | if_then_else | choose )
            int alt4=6;
            switch ( input.LA(1) ) {
            case ID:
                {
                alt4=1;
                }
                break;
            case 51:
                {
                alt4=2;
                }
                break;
            case 56:
                {
                alt4=3;
                }
                break;
            case 44:
                {
                alt4=4;
                }
                break;
            case 46:
                {
                alt4=5;
                }
                break;
            case 30:
                {
                alt4=6;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 4, 0, input);

                throw nvae;

            }

            switch (alt4) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:43:4: action_exec ';'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_action_exec_in_statement157);
                    action_exec18=action_exec();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, action_exec18.getTree());

                    char_literal19=(Token)match(input,18,FOLLOW_18_in_statement159); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal19_tree = 
                    (CommonTree)adaptor.create(char_literal19)
                    ;
                    adaptor.addChild(root_0, char_literal19_tree);
                    }

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:44:4: pick
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_pick_in_statement164);
                    pick20=pick();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, pick20.getTree());

                    }
                    break;
                case 3 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:45:4: test ';'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_test_in_statement169);
                    test21=test();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, test21.getTree());

                    char_literal22=(Token)match(input,18,FOLLOW_18_in_statement171); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal22_tree = 
                    (CommonTree)adaptor.create(char_literal22)
                    ;
                    adaptor.addChild(root_0, char_literal22_tree);
                    }

                    }
                    break;
                case 4 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:46:4: for_loop
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_for_loop_in_statement176);
                    for_loop23=for_loop();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, for_loop23.getTree());

                    }
                    break;
                case 5 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:47:4: if_then_else
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_if_then_else_in_statement181);
                    if_then_else24=if_then_else();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, if_then_else24.getTree());

                    }
                    break;
                case 6 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:48:4: choose
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_choose_in_statement186);
                    choose25=choose();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, choose25.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "statement"


    public static class action_exec_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "action_exec"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:51:1: action_exec : ID '(' arglist ')' ;
    public final YAGIParser.action_exec_return action_exec() throws RecognitionException {
        YAGIParser.action_exec_return retval = new YAGIParser.action_exec_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token ID26=null;
        Token char_literal27=null;
        Token char_literal29=null;
        YAGIParser.arglist_return arglist28 =null;


        CommonTree ID26_tree=null;
        CommonTree char_literal27_tree=null;
        CommonTree char_literal29_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:52:2: ( ID '(' arglist ')' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:52:4: ID '(' arglist ')'
            {
            root_0 = (CommonTree)adaptor.nil();


            ID26=(Token)match(input,ID,FOLLOW_ID_in_action_exec197); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID26_tree = 
            (CommonTree)adaptor.create(ID26)
            ;
            adaptor.addChild(root_0, ID26_tree);
            }

            char_literal27=(Token)match(input,11,FOLLOW_11_in_action_exec199); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal27_tree = 
            (CommonTree)adaptor.create(char_literal27)
            ;
            adaptor.addChild(root_0, char_literal27_tree);
            }

            pushFollow(FOLLOW_arglist_in_action_exec201);
            arglist28=arglist();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, arglist28.getTree());

            char_literal29=(Token)match(input,12,FOLLOW_12_in_action_exec202); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal29_tree = 
            (CommonTree)adaptor.create(char_literal29)
            ;
            adaptor.addChild(root_0, char_literal29_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "action_exec"


    public static class arglist_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "arglist"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:55:1: arglist : (| value ( ',' value )* );
    public final YAGIParser.arglist_return arglist() throws RecognitionException {
        YAGIParser.arglist_return retval = new YAGIParser.arglist_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token char_literal31=null;
        YAGIParser.value_return value30 =null;

        YAGIParser.value_return value32 =null;


        CommonTree char_literal31_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:56:2: (| value ( ',' value )* )
            int alt6=2;
            int LA6_0 = input.LA(1);

            if ( (LA6_0==12) ) {
                alt6=1;
            }
            else if ( ((LA6_0 >= INT && LA6_0 <= STRING)||LA6_0==10) ) {
                alt6=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 6, 0, input);

                throw nvae;

            }
            switch (alt6) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:57:2: 
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:57:4: value ( ',' value )*
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_value_in_arglist218);
                    value30=value();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, value30.getTree());

                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:57:10: ( ',' value )*
                    loop5:
                    do {
                        int alt5=2;
                        int LA5_0 = input.LA(1);

                        if ( (LA5_0==15) ) {
                            alt5=1;
                        }


                        switch (alt5) {
                    	case 1 :
                    	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:57:12: ',' value
                    	    {
                    	    char_literal31=(Token)match(input,15,FOLLOW_15_in_arglist222); if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) {
                    	    char_literal31_tree = 
                    	    (CommonTree)adaptor.create(char_literal31)
                    	    ;
                    	    adaptor.addChild(root_0, char_literal31_tree);
                    	    }

                    	    pushFollow(FOLLOW_value_in_arglist224);
                    	    value32=value();

                    	    state._fsp--;
                    	    if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) adaptor.addChild(root_0, value32.getTree());

                    	    }
                    	    break;

                    	default :
                    	    break loop5;
                        }
                    } while (true);


                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "arglist"


    public static class pick_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "pick"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:60:1: pick : 'pick' var 'from' setexpr 'such' block 'end pick' ;
    public final YAGIParser.pick_return pick() throws RecognitionException {
        YAGIParser.pick_return retval = new YAGIParser.pick_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal33=null;
        Token string_literal35=null;
        Token string_literal37=null;
        Token string_literal39=null;
        YAGIParser.var_return var34 =null;

        YAGIParser.setexpr_return setexpr36 =null;

        YAGIParser.block_return block38 =null;


        CommonTree string_literal33_tree=null;
        CommonTree string_literal35_tree=null;
        CommonTree string_literal37_tree=null;
        CommonTree string_literal39_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:60:6: ( 'pick' var 'from' setexpr 'such' block 'end pick' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:60:8: 'pick' var 'from' setexpr 'such' block 'end pick'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal33=(Token)match(input,51,FOLLOW_51_in_pick237); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal33_tree = 
            (CommonTree)adaptor.create(string_literal33)
            ;
            adaptor.addChild(root_0, string_literal33_tree);
            }

            pushFollow(FOLLOW_var_in_pick239);
            var34=var();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, var34.getTree());

            string_literal35=(Token)match(input,45,FOLLOW_45_in_pick241); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal35_tree = 
            (CommonTree)adaptor.create(string_literal35)
            ;
            adaptor.addChild(root_0, string_literal35_tree);
            }

            pushFollow(FOLLOW_setexpr_in_pick243);
            setexpr36=setexpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr36.getTree());

            string_literal37=(Token)match(input,55,FOLLOW_55_in_pick245); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal37_tree = 
            (CommonTree)adaptor.create(string_literal37)
            ;
            adaptor.addChild(root_0, string_literal37_tree);
            }

            pushFollow(FOLLOW_block_in_pick247);
            block38=block();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, block38.getTree());

            string_literal39=(Token)match(input,38,FOLLOW_38_in_pick249); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal39_tree = 
            (CommonTree)adaptor.create(string_literal39)
            ;
            adaptor.addChild(root_0, string_literal39_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "pick"


    public static class test_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "test"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:63:1: test : 'test' formula ;
    public final YAGIParser.test_return test() throws RecognitionException {
        YAGIParser.test_return retval = new YAGIParser.test_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal40=null;
        YAGIParser.formula_return formula41 =null;


        CommonTree string_literal40_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:63:6: ( 'test' formula )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:63:8: 'test' formula
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal40=(Token)match(input,56,FOLLOW_56_in_test259); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal40_tree = 
            (CommonTree)adaptor.create(string_literal40)
            ;
            adaptor.addChild(root_0, string_literal40_tree);
            }

            pushFollow(FOLLOW_formula_in_test261);
            formula41=formula();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, formula41.getTree());

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "test"


    public static class for_loop_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "for_loop"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:66:1: for_loop : 'for' var 'in' setexpr 'do' block 'end for' ;
    public final YAGIParser.for_loop_return for_loop() throws RecognitionException {
        YAGIParser.for_loop_return retval = new YAGIParser.for_loop_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal42=null;
        Token string_literal44=null;
        Token string_literal46=null;
        Token string_literal48=null;
        YAGIParser.var_return var43 =null;

        YAGIParser.setexpr_return setexpr45 =null;

        YAGIParser.block_return block47 =null;


        CommonTree string_literal42_tree=null;
        CommonTree string_literal44_tree=null;
        CommonTree string_literal46_tree=null;
        CommonTree string_literal48_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:66:9: ( 'for' var 'in' setexpr 'do' block 'end for' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:66:11: 'for' var 'in' setexpr 'do' block 'end for'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal42=(Token)match(input,44,FOLLOW_44_in_for_loop271); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal42_tree = 
            (CommonTree)adaptor.create(string_literal42)
            ;
            adaptor.addChild(root_0, string_literal42_tree);
            }

            pushFollow(FOLLOW_var_in_for_loop273);
            var43=var();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, var43.getTree());

            string_literal44=(Token)match(input,47,FOLLOW_47_in_for_loop275); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal44_tree = 
            (CommonTree)adaptor.create(string_literal44)
            ;
            adaptor.addChild(root_0, string_literal44_tree);
            }

            pushFollow(FOLLOW_setexpr_in_for_loop277);
            setexpr45=setexpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr45.getTree());

            string_literal46=(Token)match(input,31,FOLLOW_31_in_for_loop279); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal46_tree = 
            (CommonTree)adaptor.create(string_literal46)
            ;
            adaptor.addChild(root_0, string_literal46_tree);
            }

            pushFollow(FOLLOW_block_in_for_loop281);
            block47=block();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, block47.getTree());

            string_literal48=(Token)match(input,36,FOLLOW_36_in_for_loop283); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal48_tree = 
            (CommonTree)adaptor.create(string_literal48)
            ;
            adaptor.addChild(root_0, string_literal48_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "for_loop"


    public static class if_then_else_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "if_then_else"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:69:1: if_then_else : 'if' formula 'then' block ( 'else' block )? 'end if' ;
    public final YAGIParser.if_then_else_return if_then_else() throws RecognitionException {
        YAGIParser.if_then_else_return retval = new YAGIParser.if_then_else_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal49=null;
        Token string_literal51=null;
        Token string_literal53=null;
        Token string_literal55=null;
        YAGIParser.formula_return formula50 =null;

        YAGIParser.block_return block52 =null;

        YAGIParser.block_return block54 =null;


        CommonTree string_literal49_tree=null;
        CommonTree string_literal51_tree=null;
        CommonTree string_literal53_tree=null;
        CommonTree string_literal55_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:70:2: ( 'if' formula 'then' block ( 'else' block )? 'end if' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:70:4: 'if' formula 'then' block ( 'else' block )? 'end if'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal49=(Token)match(input,46,FOLLOW_46_in_if_then_else295); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal49_tree = 
            (CommonTree)adaptor.create(string_literal49)
            ;
            adaptor.addChild(root_0, string_literal49_tree);
            }

            pushFollow(FOLLOW_formula_in_if_then_else297);
            formula50=formula();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, formula50.getTree());

            string_literal51=(Token)match(input,57,FOLLOW_57_in_if_then_else299); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal51_tree = 
            (CommonTree)adaptor.create(string_literal51)
            ;
            adaptor.addChild(root_0, string_literal51_tree);
            }

            pushFollow(FOLLOW_block_in_if_then_else301);
            block52=block();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, block52.getTree());

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:70:30: ( 'else' block )?
            int alt7=2;
            int LA7_0 = input.LA(1);

            if ( (LA7_0==33) ) {
                alt7=1;
            }
            switch (alt7) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:70:31: 'else' block
                    {
                    string_literal53=(Token)match(input,33,FOLLOW_33_in_if_then_else304); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal53_tree = 
                    (CommonTree)adaptor.create(string_literal53)
                    ;
                    adaptor.addChild(root_0, string_literal53_tree);
                    }

                    pushFollow(FOLLOW_block_in_if_then_else306);
                    block54=block();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, block54.getTree());

                    }
                    break;

            }


            string_literal55=(Token)match(input,37,FOLLOW_37_in_if_then_else310); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal55_tree = 
            (CommonTree)adaptor.create(string_literal55)
            ;
            adaptor.addChild(root_0, string_literal55_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "if_then_else"


    public static class choose_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "choose"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:73:1: choose : 'choose' block ( 'or' block )+ 'end choose' ;
    public final YAGIParser.choose_return choose() throws RecognitionException {
        YAGIParser.choose_return retval = new YAGIParser.choose_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal56=null;
        Token string_literal58=null;
        Token string_literal60=null;
        YAGIParser.block_return block57 =null;

        YAGIParser.block_return block59 =null;


        CommonTree string_literal56_tree=null;
        CommonTree string_literal58_tree=null;
        CommonTree string_literal60_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:73:8: ( 'choose' block ( 'or' block )+ 'end choose' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:73:10: 'choose' block ( 'or' block )+ 'end choose'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal56=(Token)match(input,30,FOLLOW_30_in_choose320); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal56_tree = 
            (CommonTree)adaptor.create(string_literal56)
            ;
            adaptor.addChild(root_0, string_literal56_tree);
            }

            pushFollow(FOLLOW_block_in_choose322);
            block57=block();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, block57.getTree());

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:73:25: ( 'or' block )+
            int cnt8=0;
            loop8:
            do {
                int alt8=2;
                int LA8_0 = input.LA(1);

                if ( (LA8_0==50) ) {
                    alt8=1;
                }


                switch (alt8) {
            	case 1 :
            	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:73:27: 'or' block
            	    {
            	    string_literal58=(Token)match(input,50,FOLLOW_50_in_choose326); if (state.failed) return retval;
            	    if ( state.backtracking==0 ) {
            	    string_literal58_tree = 
            	    (CommonTree)adaptor.create(string_literal58)
            	    ;
            	    adaptor.addChild(root_0, string_literal58_tree);
            	    }

            	    pushFollow(FOLLOW_block_in_choose328);
            	    block59=block();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, block59.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt8 >= 1 ) break loop8;
            	    if (state.backtracking>0) {state.failed=true; return retval;}
                        EarlyExitException eee =
                            new EarlyExitException(8, input);
                        throw eee;
                }
                cnt8++;
            } while (true);


            string_literal60=(Token)match(input,35,FOLLOW_35_in_choose333); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal60_tree = 
            (CommonTree)adaptor.create(string_literal60)
            ;
            adaptor.addChild(root_0, string_literal60_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "choose"


    public static class action_decl_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "action_decl"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:80:1: action_decl : 'action' ID '(' varlist ')' ( 'precondition:' formula )? ( 'effect:' assignment )? ( 'signal:' valexpr )? 'end action' ;
    public final YAGIParser.action_decl_return action_decl() throws RecognitionException {
        YAGIParser.action_decl_return retval = new YAGIParser.action_decl_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal61=null;
        Token ID62=null;
        Token char_literal63=null;
        Token char_literal65=null;
        Token string_literal66=null;
        Token string_literal68=null;
        Token string_literal70=null;
        Token string_literal72=null;
        YAGIParser.varlist_return varlist64 =null;

        YAGIParser.formula_return formula67 =null;

        YAGIParser.assignment_return assignment69 =null;

        YAGIParser.valexpr_return valexpr71 =null;


        CommonTree string_literal61_tree=null;
        CommonTree ID62_tree=null;
        CommonTree char_literal63_tree=null;
        CommonTree char_literal65_tree=null;
        CommonTree string_literal66_tree=null;
        CommonTree string_literal68_tree=null;
        CommonTree string_literal70_tree=null;
        CommonTree string_literal72_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:81:2: ( 'action' ID '(' varlist ')' ( 'precondition:' formula )? ( 'effect:' assignment )? ( 'signal:' valexpr )? 'end action' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:81:4: 'action' ID '(' varlist ')' ( 'precondition:' formula )? ( 'effect:' assignment )? ( 'signal:' valexpr )? 'end action'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal61=(Token)match(input,27,FOLLOW_27_in_action_decl349); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal61_tree = 
            (CommonTree)adaptor.create(string_literal61)
            ;
            adaptor.addChild(root_0, string_literal61_tree);
            }

            ID62=(Token)match(input,ID,FOLLOW_ID_in_action_decl351); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID62_tree = 
            (CommonTree)adaptor.create(ID62)
            ;
            adaptor.addChild(root_0, ID62_tree);
            }

            char_literal63=(Token)match(input,11,FOLLOW_11_in_action_decl353); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal63_tree = 
            (CommonTree)adaptor.create(char_literal63)
            ;
            adaptor.addChild(root_0, char_literal63_tree);
            }

            pushFollow(FOLLOW_varlist_in_action_decl355);
            varlist64=varlist();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, varlist64.getTree());

            char_literal65=(Token)match(input,12,FOLLOW_12_in_action_decl357); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal65_tree = 
            (CommonTree)adaptor.create(char_literal65)
            ;
            adaptor.addChild(root_0, char_literal65_tree);
            }

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:82:3: ( 'precondition:' formula )?
            int alt9=2;
            int LA9_0 = input.LA(1);

            if ( (LA9_0==52) ) {
                alt9=1;
            }
            switch (alt9) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:82:4: 'precondition:' formula
                    {
                    string_literal66=(Token)match(input,52,FOLLOW_52_in_action_decl362); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal66_tree = 
                    (CommonTree)adaptor.create(string_literal66)
                    ;
                    adaptor.addChild(root_0, string_literal66_tree);
                    }

                    pushFollow(FOLLOW_formula_in_action_decl364);
                    formula67=formula();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, formula67.getTree());

                    }
                    break;

            }


            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:83:3: ( 'effect:' assignment )?
            int alt10=2;
            int LA10_0 = input.LA(1);

            if ( (LA10_0==32) ) {
                alt10=1;
            }
            switch (alt10) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:83:4: 'effect:' assignment
                    {
                    string_literal68=(Token)match(input,32,FOLLOW_32_in_action_decl371); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal68_tree = 
                    (CommonTree)adaptor.create(string_literal68)
                    ;
                    adaptor.addChild(root_0, string_literal68_tree);
                    }

                    pushFollow(FOLLOW_assignment_in_action_decl373);
                    assignment69=assignment();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment69.getTree());

                    }
                    break;

            }


            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:84:3: ( 'signal:' valexpr )?
            int alt11=2;
            int LA11_0 = input.LA(1);

            if ( (LA11_0==54) ) {
                alt11=1;
            }
            switch (alt11) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:84:4: 'signal:' valexpr
                    {
                    string_literal70=(Token)match(input,54,FOLLOW_54_in_action_decl380); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal70_tree = 
                    (CommonTree)adaptor.create(string_literal70)
                    ;
                    adaptor.addChild(root_0, string_literal70_tree);
                    }

                    pushFollow(FOLLOW_valexpr_in_action_decl382);
                    valexpr71=valexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, valexpr71.getTree());

                    }
                    break;

            }


            string_literal72=(Token)match(input,34,FOLLOW_34_in_action_decl388); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal72_tree = 
            (CommonTree)adaptor.create(string_literal72)
            ;
            adaptor.addChild(root_0, string_literal72_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "action_decl"


    public static class varlist_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "varlist"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:88:1: varlist : (| var ( ',' var )* );
    public final YAGIParser.varlist_return varlist() throws RecognitionException {
        YAGIParser.varlist_return retval = new YAGIParser.varlist_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token char_literal74=null;
        YAGIParser.var_return var73 =null;

        YAGIParser.var_return var75 =null;


        CommonTree char_literal74_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:89:2: (| var ( ',' var )* )
            int alt13=2;
            int LA13_0 = input.LA(1);

            if ( (LA13_0==12) ) {
                alt13=1;
            }
            else if ( (LA13_0==10) ) {
                alt13=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 13, 0, input);

                throw nvae;

            }
            switch (alt13) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:90:2: 
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:90:4: var ( ',' var )*
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_var_in_varlist403);
                    var73=var();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, var73.getTree());

                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:90:8: ( ',' var )*
                    loop12:
                    do {
                        int alt12=2;
                        int LA12_0 = input.LA(1);

                        if ( (LA12_0==15) ) {
                            alt12=1;
                        }


                        switch (alt12) {
                    	case 1 :
                    	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:90:10: ',' var
                    	    {
                    	    char_literal74=(Token)match(input,15,FOLLOW_15_in_varlist407); if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) {
                    	    char_literal74_tree = 
                    	    (CommonTree)adaptor.create(char_literal74)
                    	    ;
                    	    adaptor.addChild(root_0, char_literal74_tree);
                    	    }

                    	    pushFollow(FOLLOW_var_in_varlist409);
                    	    var75=var();

                    	    state._fsp--;
                    	    if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) adaptor.addChild(root_0, var75.getTree());

                    	    }
                    	    break;

                    	default :
                    	    break loop12;
                        }
                    } while (true);


                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "varlist"


    public static class assignment_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "assignment"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:97:1: assignment : ( assign ';' | for_loop_assign | conditional_assign );
    public final YAGIParser.assignment_return assignment() throws RecognitionException {
        YAGIParser.assignment_return retval = new YAGIParser.assignment_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token char_literal77=null;
        YAGIParser.assign_return assign76 =null;

        YAGIParser.for_loop_assign_return for_loop_assign78 =null;

        YAGIParser.conditional_assign_return conditional_assign79 =null;


        CommonTree char_literal77_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:98:2: ( assign ';' | for_loop_assign | conditional_assign )
            int alt14=3;
            switch ( input.LA(1) ) {
            case ID:
            case 10:
                {
                alt14=1;
                }
                break;
            case 44:
                {
                alt14=2;
                }
                break;
            case 46:
                {
                alt14=3;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 14, 0, input);

                throw nvae;

            }

            switch (alt14) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:98:4: assign ';'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_assign_in_assignment427);
                    assign76=assign();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assign76.getTree());

                    char_literal77=(Token)match(input,18,FOLLOW_18_in_assignment429); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal77_tree = 
                    (CommonTree)adaptor.create(char_literal77)
                    ;
                    adaptor.addChild(root_0, char_literal77_tree);
                    }

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:99:4: for_loop_assign
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_for_loop_assign_in_assignment434);
                    for_loop_assign78=for_loop_assign();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, for_loop_assign78.getTree());

                    }
                    break;
                case 3 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:100:4: conditional_assign
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_conditional_assign_in_assignment439);
                    conditional_assign79=conditional_assign();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, conditional_assign79.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "assignment"


    public static class for_loop_assign_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "for_loop_assign"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:103:1: for_loop_assign : 'for' var 'in' setexpr 'do' assignment 'end for' ;
    public final YAGIParser.for_loop_assign_return for_loop_assign() throws RecognitionException {
        YAGIParser.for_loop_assign_return retval = new YAGIParser.for_loop_assign_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal80=null;
        Token string_literal82=null;
        Token string_literal84=null;
        Token string_literal86=null;
        YAGIParser.var_return var81 =null;

        YAGIParser.setexpr_return setexpr83 =null;

        YAGIParser.assignment_return assignment85 =null;


        CommonTree string_literal80_tree=null;
        CommonTree string_literal82_tree=null;
        CommonTree string_literal84_tree=null;
        CommonTree string_literal86_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:104:2: ( 'for' var 'in' setexpr 'do' assignment 'end for' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:104:4: 'for' var 'in' setexpr 'do' assignment 'end for'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal80=(Token)match(input,44,FOLLOW_44_in_for_loop_assign450); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal80_tree = 
            (CommonTree)adaptor.create(string_literal80)
            ;
            adaptor.addChild(root_0, string_literal80_tree);
            }

            pushFollow(FOLLOW_var_in_for_loop_assign452);
            var81=var();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, var81.getTree());

            string_literal82=(Token)match(input,47,FOLLOW_47_in_for_loop_assign454); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal82_tree = 
            (CommonTree)adaptor.create(string_literal82)
            ;
            adaptor.addChild(root_0, string_literal82_tree);
            }

            pushFollow(FOLLOW_setexpr_in_for_loop_assign456);
            setexpr83=setexpr();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr83.getTree());

            string_literal84=(Token)match(input,31,FOLLOW_31_in_for_loop_assign458); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal84_tree = 
            (CommonTree)adaptor.create(string_literal84)
            ;
            adaptor.addChild(root_0, string_literal84_tree);
            }

            pushFollow(FOLLOW_assignment_in_for_loop_assign460);
            assignment85=assignment();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment85.getTree());

            string_literal86=(Token)match(input,36,FOLLOW_36_in_for_loop_assign462); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal86_tree = 
            (CommonTree)adaptor.create(string_literal86)
            ;
            adaptor.addChild(root_0, string_literal86_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "for_loop_assign"


    public static class conditional_assign_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "conditional_assign"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:107:1: conditional_assign : 'if' formula 'then' assignment ( 'else' assignment )? 'end if' ;
    public final YAGIParser.conditional_assign_return conditional_assign() throws RecognitionException {
        YAGIParser.conditional_assign_return retval = new YAGIParser.conditional_assign_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal87=null;
        Token string_literal89=null;
        Token string_literal91=null;
        Token string_literal93=null;
        YAGIParser.formula_return formula88 =null;

        YAGIParser.assignment_return assignment90 =null;

        YAGIParser.assignment_return assignment92 =null;


        CommonTree string_literal87_tree=null;
        CommonTree string_literal89_tree=null;
        CommonTree string_literal91_tree=null;
        CommonTree string_literal93_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:108:2: ( 'if' formula 'then' assignment ( 'else' assignment )? 'end if' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:108:4: 'if' formula 'then' assignment ( 'else' assignment )? 'end if'
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal87=(Token)match(input,46,FOLLOW_46_in_conditional_assign474); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal87_tree = 
            (CommonTree)adaptor.create(string_literal87)
            ;
            adaptor.addChild(root_0, string_literal87_tree);
            }

            pushFollow(FOLLOW_formula_in_conditional_assign476);
            formula88=formula();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, formula88.getTree());

            string_literal89=(Token)match(input,57,FOLLOW_57_in_conditional_assign478); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal89_tree = 
            (CommonTree)adaptor.create(string_literal89)
            ;
            adaptor.addChild(root_0, string_literal89_tree);
            }

            pushFollow(FOLLOW_assignment_in_conditional_assign480);
            assignment90=assignment();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment90.getTree());

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:108:35: ( 'else' assignment )?
            int alt15=2;
            int LA15_0 = input.LA(1);

            if ( (LA15_0==33) ) {
                alt15=1;
            }
            switch (alt15) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:108:36: 'else' assignment
                    {
                    string_literal91=(Token)match(input,33,FOLLOW_33_in_conditional_assign483); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal91_tree = 
                    (CommonTree)adaptor.create(string_literal91)
                    ;
                    adaptor.addChild(root_0, string_literal91_tree);
                    }

                    pushFollow(FOLLOW_assignment_in_conditional_assign485);
                    assignment92=assignment();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assignment92.getTree());

                    }
                    break;

            }


            string_literal93=(Token)match(input,37,FOLLOW_37_in_conditional_assign489); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal93_tree = 
            (CommonTree)adaptor.create(string_literal93)
            ;
            adaptor.addChild(root_0, string_literal93_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "conditional_assign"


    public static class assign_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "assign"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:111:1: assign : ( term assign_op setexpr | var assign_op valexpr );
    public final YAGIParser.assign_return assign() throws RecognitionException {
        YAGIParser.assign_return retval = new YAGIParser.assign_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        YAGIParser.term_return term94 =null;

        YAGIParser.assign_op_return assign_op95 =null;

        YAGIParser.setexpr_return setexpr96 =null;

        YAGIParser.var_return var97 =null;

        YAGIParser.assign_op_return assign_op98 =null;

        YAGIParser.valexpr_return valexpr99 =null;



        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:112:2: ( term assign_op setexpr | var assign_op valexpr )
            int alt16=2;
            int LA16_0 = input.LA(1);

            if ( (LA16_0==ID) ) {
                alt16=1;
            }
            else if ( (LA16_0==10) ) {
                alt16=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 16, 0, input);

                throw nvae;

            }
            switch (alt16) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:112:4: term assign_op setexpr
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_term_in_assign501);
                    term94=term();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, term94.getTree());

                    pushFollow(FOLLOW_assign_op_in_assign503);
                    assign_op95=assign_op();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assign_op95.getTree());

                    pushFollow(FOLLOW_setexpr_in_assign505);
                    setexpr96=setexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr96.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:113:4: var assign_op valexpr
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_var_in_assign510);
                    var97=var();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, var97.getTree());

                    pushFollow(FOLLOW_assign_op_in_assign512);
                    assign_op98=assign_op();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, assign_op98.getTree());

                    pushFollow(FOLLOW_valexpr_in_assign514);
                    valexpr99=valexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, valexpr99.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "assign"


    public static class assign_op_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "assign_op"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:116:1: assign_op : ( '=' | '+=' | '-=' );
    public final YAGIParser.assign_op_return assign_op() throws RecognitionException {
        YAGIParser.assign_op_return retval = new YAGIParser.assign_op_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token set100=null;

        CommonTree set100_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:117:2: ( '=' | '+=' | '-=' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:
            {
            root_0 = (CommonTree)adaptor.nil();


            set100=(Token)input.LT(1);

            if ( input.LA(1)==14||input.LA(1)==17||input.LA(1)==21 ) {
                input.consume();
                if ( state.backtracking==0 ) adaptor.addChild(root_0, 
                (CommonTree)adaptor.create(set100)
                );
                state.errorRecovery=false;
                state.failed=false;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "assign_op"


    public static class formula_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "formula"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:124:1: formula : ( atom | 'not' '(' formula ')' | '(' atom connective formula ')' | 'exists' var 'in' setexpr 'such' formula | 'all' var 'in' setexpr 'such' formula );
    public final YAGIParser.formula_return formula() throws RecognitionException {
        YAGIParser.formula_return retval = new YAGIParser.formula_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal102=null;
        Token char_literal103=null;
        Token char_literal105=null;
        Token char_literal106=null;
        Token char_literal110=null;
        Token string_literal111=null;
        Token string_literal113=null;
        Token string_literal115=null;
        Token string_literal117=null;
        Token string_literal119=null;
        Token string_literal121=null;
        YAGIParser.atom_return atom101 =null;

        YAGIParser.formula_return formula104 =null;

        YAGIParser.atom_return atom107 =null;

        YAGIParser.connective_return connective108 =null;

        YAGIParser.formula_return formula109 =null;

        YAGIParser.var_return var112 =null;

        YAGIParser.setexpr_return setexpr114 =null;

        YAGIParser.formula_return formula116 =null;

        YAGIParser.var_return var118 =null;

        YAGIParser.setexpr_return setexpr120 =null;

        YAGIParser.formula_return formula122 =null;


        CommonTree string_literal102_tree=null;
        CommonTree char_literal103_tree=null;
        CommonTree char_literal105_tree=null;
        CommonTree char_literal106_tree=null;
        CommonTree char_literal110_tree=null;
        CommonTree string_literal111_tree=null;
        CommonTree string_literal113_tree=null;
        CommonTree string_literal115_tree=null;
        CommonTree string_literal117_tree=null;
        CommonTree string_literal119_tree=null;
        CommonTree string_literal121_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:124:9: ( atom | 'not' '(' formula ')' | '(' atom connective formula ')' | 'exists' var 'in' setexpr 'such' formula | 'all' var 'in' setexpr 'such' formula )
            int alt17=5;
            switch ( input.LA(1) ) {
            case ID:
            case INT:
            case STRING:
            case 10:
            case 42:
            case 58:
            case 59:
                {
                alt17=1;
                }
                break;
            case 49:
                {
                alt17=2;
                }
                break;
            case 11:
                {
                alt17=3;
                }
                break;
            case 40:
                {
                alt17=4;
                }
                break;
            case 28:
                {
                alt17=5;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 17, 0, input);

                throw nvae;

            }

            switch (alt17) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:124:11: atom
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_atom_in_formula550);
                    atom101=atom();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, atom101.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:125:4: 'not' '(' formula ')'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    string_literal102=(Token)match(input,49,FOLLOW_49_in_formula555); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal102_tree = 
                    (CommonTree)adaptor.create(string_literal102)
                    ;
                    adaptor.addChild(root_0, string_literal102_tree);
                    }

                    char_literal103=(Token)match(input,11,FOLLOW_11_in_formula557); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal103_tree = 
                    (CommonTree)adaptor.create(char_literal103)
                    ;
                    adaptor.addChild(root_0, char_literal103_tree);
                    }

                    pushFollow(FOLLOW_formula_in_formula559);
                    formula104=formula();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, formula104.getTree());

                    char_literal105=(Token)match(input,12,FOLLOW_12_in_formula561); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal105_tree = 
                    (CommonTree)adaptor.create(char_literal105)
                    ;
                    adaptor.addChild(root_0, char_literal105_tree);
                    }

                    }
                    break;
                case 3 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:126:4: '(' atom connective formula ')'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    char_literal106=(Token)match(input,11,FOLLOW_11_in_formula566); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal106_tree = 
                    (CommonTree)adaptor.create(char_literal106)
                    ;
                    adaptor.addChild(root_0, char_literal106_tree);
                    }

                    pushFollow(FOLLOW_atom_in_formula568);
                    atom107=atom();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, atom107.getTree());

                    pushFollow(FOLLOW_connective_in_formula570);
                    connective108=connective();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, connective108.getTree());

                    pushFollow(FOLLOW_formula_in_formula572);
                    formula109=formula();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, formula109.getTree());

                    char_literal110=(Token)match(input,12,FOLLOW_12_in_formula574); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal110_tree = 
                    (CommonTree)adaptor.create(char_literal110)
                    ;
                    adaptor.addChild(root_0, char_literal110_tree);
                    }

                    }
                    break;
                case 4 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:127:4: 'exists' var 'in' setexpr 'such' formula
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    string_literal111=(Token)match(input,40,FOLLOW_40_in_formula579); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal111_tree = 
                    (CommonTree)adaptor.create(string_literal111)
                    ;
                    adaptor.addChild(root_0, string_literal111_tree);
                    }

                    pushFollow(FOLLOW_var_in_formula581);
                    var112=var();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, var112.getTree());

                    string_literal113=(Token)match(input,47,FOLLOW_47_in_formula583); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal113_tree = 
                    (CommonTree)adaptor.create(string_literal113)
                    ;
                    adaptor.addChild(root_0, string_literal113_tree);
                    }

                    pushFollow(FOLLOW_setexpr_in_formula585);
                    setexpr114=setexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr114.getTree());

                    string_literal115=(Token)match(input,55,FOLLOW_55_in_formula587); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal115_tree = 
                    (CommonTree)adaptor.create(string_literal115)
                    ;
                    adaptor.addChild(root_0, string_literal115_tree);
                    }

                    pushFollow(FOLLOW_formula_in_formula589);
                    formula116=formula();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, formula116.getTree());

                    }
                    break;
                case 5 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:128:4: 'all' var 'in' setexpr 'such' formula
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    string_literal117=(Token)match(input,28,FOLLOW_28_in_formula594); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal117_tree = 
                    (CommonTree)adaptor.create(string_literal117)
                    ;
                    adaptor.addChild(root_0, string_literal117_tree);
                    }

                    pushFollow(FOLLOW_var_in_formula596);
                    var118=var();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, var118.getTree());

                    string_literal119=(Token)match(input,47,FOLLOW_47_in_formula598); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal119_tree = 
                    (CommonTree)adaptor.create(string_literal119)
                    ;
                    adaptor.addChild(root_0, string_literal119_tree);
                    }

                    pushFollow(FOLLOW_setexpr_in_formula600);
                    setexpr120=setexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr120.getTree());

                    string_literal121=(Token)match(input,55,FOLLOW_55_in_formula602); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal121_tree = 
                    (CommonTree)adaptor.create(string_literal121)
                    ;
                    adaptor.addChild(root_0, string_literal121_tree);
                    }

                    pushFollow(FOLLOW_formula_in_formula604);
                    formula122=formula();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, formula122.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "formula"


    public static class connective_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "connective"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:131:1: connective : ( 'and' | 'or' );
    public final YAGIParser.connective_return connective() throws RecognitionException {
        YAGIParser.connective_return retval = new YAGIParser.connective_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token set123=null;

        CommonTree set123_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:132:2: ( 'and' | 'or' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:
            {
            root_0 = (CommonTree)adaptor.nil();


            set123=(Token)input.LT(1);

            if ( input.LA(1)==29||input.LA(1)==50 ) {
                input.consume();
                if ( state.backtracking==0 ) adaptor.addChild(root_0, 
                (CommonTree)adaptor.create(set123)
                );
                state.errorRecovery=false;
                state.failed=false;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "connective"


    public static class atom_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "atom"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:136:1: atom : ( valexpr comp_op valexpr | setexpr comp_op setexpr | value 'in' setexpr | ( 'true' | 'false' ) );
    public final YAGIParser.atom_return atom() throws RecognitionException {
        YAGIParser.atom_return retval = new YAGIParser.atom_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal131=null;
        Token set133=null;
        YAGIParser.valexpr_return valexpr124 =null;

        YAGIParser.comp_op_return comp_op125 =null;

        YAGIParser.valexpr_return valexpr126 =null;

        YAGIParser.setexpr_return setexpr127 =null;

        YAGIParser.comp_op_return comp_op128 =null;

        YAGIParser.setexpr_return setexpr129 =null;

        YAGIParser.value_return value130 =null;

        YAGIParser.setexpr_return setexpr132 =null;


        CommonTree string_literal131_tree=null;
        CommonTree set133_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:137:2: ( valexpr comp_op valexpr | setexpr comp_op setexpr | value 'in' setexpr | ( 'true' | 'false' ) )
            int alt18=4;
            switch ( input.LA(1) ) {
            case INT:
                {
                int LA18_1 = input.LA(2);

                if ( (LA18_1==9||LA18_1==13||LA18_1==16||(LA18_1 >= 19 && LA18_1 <= 20)||(LA18_1 >= 22 && LA18_1 <= 24)) ) {
                    alt18=1;
                }
                else if ( (LA18_1==47) ) {
                    alt18=3;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 18, 1, input);

                    throw nvae;

                }
                }
                break;
            case STRING:
                {
                int LA18_2 = input.LA(2);

                if ( (LA18_2==9||LA18_2==13||LA18_2==16||(LA18_2 >= 19 && LA18_2 <= 20)||(LA18_2 >= 22 && LA18_2 <= 24)) ) {
                    alt18=1;
                }
                else if ( (LA18_2==47) ) {
                    alt18=3;
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 18, 2, input);

                    throw nvae;

                }
                }
                break;
            case 10:
                {
                int LA18_3 = input.LA(2);

                if ( (LA18_3==ID) ) {
                    int LA18_8 = input.LA(3);

                    if ( (LA18_8==9||LA18_8==13||LA18_8==16||(LA18_8 >= 19 && LA18_8 <= 20)||(LA18_8 >= 22 && LA18_8 <= 24)) ) {
                        alt18=1;
                    }
                    else if ( (LA18_8==47) ) {
                        alt18=3;
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return retval;}
                        NoViableAltException nvae =
                            new NoViableAltException("", 18, 8, input);

                        throw nvae;

                    }
                }
                else {
                    if (state.backtracking>0) {state.failed=true; return retval;}
                    NoViableAltException nvae =
                        new NoViableAltException("", 18, 3, input);

                    throw nvae;

                }
                }
                break;
            case ID:
            case 59:
                {
                alt18=2;
                }
                break;
            case 42:
            case 58:
                {
                alt18=4;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 18, 0, input);

                throw nvae;

            }

            switch (alt18) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:137:4: valexpr comp_op valexpr
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_valexpr_in_atom633);
                    valexpr124=valexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, valexpr124.getTree());

                    pushFollow(FOLLOW_comp_op_in_atom635);
                    comp_op125=comp_op();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, comp_op125.getTree());

                    pushFollow(FOLLOW_valexpr_in_atom637);
                    valexpr126=valexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, valexpr126.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:138:4: setexpr comp_op setexpr
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_setexpr_in_atom642);
                    setexpr127=setexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr127.getTree());

                    pushFollow(FOLLOW_comp_op_in_atom644);
                    comp_op128=comp_op();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, comp_op128.getTree());

                    pushFollow(FOLLOW_setexpr_in_atom646);
                    setexpr129=setexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr129.getTree());

                    }
                    break;
                case 3 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:139:4: value 'in' setexpr
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_value_in_atom651);
                    value130=value();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, value130.getTree());

                    string_literal131=(Token)match(input,47,FOLLOW_47_in_atom653); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    string_literal131_tree = 
                    (CommonTree)adaptor.create(string_literal131)
                    ;
                    adaptor.addChild(root_0, string_literal131_tree);
                    }

                    pushFollow(FOLLOW_setexpr_in_atom655);
                    setexpr132=setexpr();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, setexpr132.getTree());

                    }
                    break;
                case 4 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:140:4: ( 'true' | 'false' )
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    set133=(Token)input.LT(1);

                    if ( input.LA(1)==42||input.LA(1)==58 ) {
                        input.consume();
                        if ( state.backtracking==0 ) adaptor.addChild(root_0, 
                        (CommonTree)adaptor.create(set133)
                        );
                        state.errorRecovery=false;
                        state.failed=false;
                    }
                    else {
                        if (state.backtracking>0) {state.failed=true; return retval;}
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        throw mse;
                    }


                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "atom"


    public static class comp_op_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "comp_op"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:143:1: comp_op : ( '==' | '!=' | '<=' | '>=' | '<' | '>' );
    public final YAGIParser.comp_op_return comp_op() throws RecognitionException {
        YAGIParser.comp_op_return retval = new YAGIParser.comp_op_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token set134=null;

        CommonTree set134_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:144:2: ( '==' | '!=' | '<=' | '>=' | '<' | '>' )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:
            {
            root_0 = (CommonTree)adaptor.nil();


            set134=(Token)input.LT(1);

            if ( input.LA(1)==9||(input.LA(1) >= 19 && input.LA(1) <= 20)||(input.LA(1) >= 22 && input.LA(1) <= 24) ) {
                input.consume();
                if ( state.backtracking==0 ) adaptor.addChild(root_0, 
                (CommonTree)adaptor.create(set134)
                );
                state.errorRecovery=false;
                state.failed=false;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "comp_op"


    public static class setexpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "setexpr"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:156:1: setexpr : set ( ( '+' | '-' ) set )* ;
    public final YAGIParser.setexpr_return setexpr() throws RecognitionException {
        YAGIParser.setexpr_return retval = new YAGIParser.setexpr_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token set136=null;
        YAGIParser.set_return set135 =null;

        YAGIParser.set_return set137 =null;


        CommonTree set136_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:156:9: ( set ( ( '+' | '-' ) set )* )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:156:11: set ( ( '+' | '-' ) set )*
            {
            root_0 = (CommonTree)adaptor.nil();


            pushFollow(FOLLOW_set_in_setexpr719);
            set135=set();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, set135.getTree());

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:156:15: ( ( '+' | '-' ) set )*
            loop19:
            do {
                int alt19=2;
                int LA19_0 = input.LA(1);

                if ( (LA19_0==13||LA19_0==16) ) {
                    alt19=1;
                }


                switch (alt19) {
            	case 1 :
            	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:156:16: ( '+' | '-' ) set
            	    {
            	    set136=(Token)input.LT(1);

            	    if ( input.LA(1)==13||input.LA(1)==16 ) {
            	        input.consume();
            	        if ( state.backtracking==0 ) adaptor.addChild(root_0, 
            	        (CommonTree)adaptor.create(set136)
            	        );
            	        state.errorRecovery=false;
            	        state.failed=false;
            	    }
            	    else {
            	        if (state.backtracking>0) {state.failed=true; return retval;}
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        throw mse;
            	    }


            	    pushFollow(FOLLOW_set_in_setexpr728);
            	    set137=set();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, set137.getTree());

            	    }
            	    break;

            	default :
            	    break loop19;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "setexpr"


    public static class set_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "set"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:159:1: set : ( '{' value ( ',' value )* '}' | term );
    public final YAGIParser.set_return set() throws RecognitionException {
        YAGIParser.set_return retval = new YAGIParser.set_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token char_literal138=null;
        Token char_literal140=null;
        Token char_literal142=null;
        YAGIParser.value_return value139 =null;

        YAGIParser.value_return value141 =null;

        YAGIParser.term_return term143 =null;


        CommonTree char_literal138_tree=null;
        CommonTree char_literal140_tree=null;
        CommonTree char_literal142_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:160:2: ( '{' value ( ',' value )* '}' | term )
            int alt21=2;
            int LA21_0 = input.LA(1);

            if ( (LA21_0==59) ) {
                alt21=1;
            }
            else if ( (LA21_0==ID) ) {
                alt21=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 21, 0, input);

                throw nvae;

            }
            switch (alt21) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:160:4: '{' value ( ',' value )* '}'
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    char_literal138=(Token)match(input,59,FOLLOW_59_in_set741); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal138_tree = 
                    (CommonTree)adaptor.create(char_literal138)
                    ;
                    adaptor.addChild(root_0, char_literal138_tree);
                    }

                    pushFollow(FOLLOW_value_in_set743);
                    value139=value();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, value139.getTree());

                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:160:14: ( ',' value )*
                    loop20:
                    do {
                        int alt20=2;
                        int LA20_0 = input.LA(1);

                        if ( (LA20_0==15) ) {
                            alt20=1;
                        }


                        switch (alt20) {
                    	case 1 :
                    	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:160:16: ',' value
                    	    {
                    	    char_literal140=(Token)match(input,15,FOLLOW_15_in_set747); if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) {
                    	    char_literal140_tree = 
                    	    (CommonTree)adaptor.create(char_literal140)
                    	    ;
                    	    adaptor.addChild(root_0, char_literal140_tree);
                    	    }

                    	    pushFollow(FOLLOW_value_in_set749);
                    	    value141=value();

                    	    state._fsp--;
                    	    if (state.failed) return retval;
                    	    if ( state.backtracking==0 ) adaptor.addChild(root_0, value141.getTree());

                    	    }
                    	    break;

                    	default :
                    	    break loop20;
                        }
                    } while (true);


                    char_literal142=(Token)match(input,60,FOLLOW_60_in_set754); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    char_literal142_tree = 
                    (CommonTree)adaptor.create(char_literal142)
                    ;
                    adaptor.addChild(root_0, char_literal142_tree);
                    }

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:161:4: term
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_term_in_set759);
                    term143=term();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, term143.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "set"


    public static class term_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "term"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:164:1: term : ID ( '[' value ']' )* ;
    public final YAGIParser.term_return term() throws RecognitionException {
        YAGIParser.term_return retval = new YAGIParser.term_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token ID144=null;
        Token char_literal145=null;
        Token char_literal147=null;
        YAGIParser.value_return value146 =null;


        CommonTree ID144_tree=null;
        CommonTree char_literal145_tree=null;
        CommonTree char_literal147_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:165:3: ( ID ( '[' value ']' )* )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:165:5: ID ( '[' value ']' )*
            {
            root_0 = (CommonTree)adaptor.nil();


            ID144=(Token)match(input,ID,FOLLOW_ID_in_term771); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID144_tree = 
            (CommonTree)adaptor.create(ID144)
            ;
            adaptor.addChild(root_0, ID144_tree);
            }

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:165:8: ( '[' value ']' )*
            loop22:
            do {
                int alt22=2;
                int LA22_0 = input.LA(1);

                if ( (LA22_0==25) ) {
                    alt22=1;
                }


                switch (alt22) {
            	case 1 :
            	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:165:10: '[' value ']'
            	    {
            	    char_literal145=(Token)match(input,25,FOLLOW_25_in_term775); if (state.failed) return retval;
            	    if ( state.backtracking==0 ) {
            	    char_literal145_tree = 
            	    (CommonTree)adaptor.create(char_literal145)
            	    ;
            	    adaptor.addChild(root_0, char_literal145_tree);
            	    }

            	    pushFollow(FOLLOW_value_in_term777);
            	    value146=value();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, value146.getTree());

            	    char_literal147=(Token)match(input,26,FOLLOW_26_in_term779); if (state.failed) return retval;
            	    if ( state.backtracking==0 ) {
            	    char_literal147_tree = 
            	    (CommonTree)adaptor.create(char_literal147)
            	    ;
            	    adaptor.addChild(root_0, char_literal147_tree);
            	    }

            	    }
            	    break;

            	default :
            	    break loop22;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "term"


    public static class valexpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "valexpr"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:168:1: valexpr : value ( ( '+' | '-' ) value )* ;
    public final YAGIParser.valexpr_return valexpr() throws RecognitionException {
        YAGIParser.valexpr_return retval = new YAGIParser.valexpr_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token set149=null;
        YAGIParser.value_return value148 =null;

        YAGIParser.value_return value150 =null;


        CommonTree set149_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:168:9: ( value ( ( '+' | '-' ) value )* )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:168:11: value ( ( '+' | '-' ) value )*
            {
            root_0 = (CommonTree)adaptor.nil();


            pushFollow(FOLLOW_value_in_valexpr792);
            value148=value();

            state._fsp--;
            if (state.failed) return retval;
            if ( state.backtracking==0 ) adaptor.addChild(root_0, value148.getTree());

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:168:17: ( ( '+' | '-' ) value )*
            loop23:
            do {
                int alt23=2;
                int LA23_0 = input.LA(1);

                if ( (LA23_0==13||LA23_0==16) ) {
                    alt23=1;
                }


                switch (alt23) {
            	case 1 :
            	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:168:18: ( '+' | '-' ) value
            	    {
            	    set149=(Token)input.LT(1);

            	    if ( input.LA(1)==13||input.LA(1)==16 ) {
            	        input.consume();
            	        if ( state.backtracking==0 ) adaptor.addChild(root_0, 
            	        (CommonTree)adaptor.create(set149)
            	        );
            	        state.errorRecovery=false;
            	        state.failed=false;
            	    }
            	    else {
            	        if (state.backtracking>0) {state.failed=true; return retval;}
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        throw mse;
            	    }


            	    pushFollow(FOLLOW_value_in_valexpr801);
            	    value150=value();

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, value150.getTree());

            	    }
            	    break;

            	default :
            	    break loop23;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "valexpr"


    public static class value_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "value"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:171:1: value : ( INT | STRING | var );
    public final YAGIParser.value_return value() throws RecognitionException {
        YAGIParser.value_return retval = new YAGIParser.value_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token INT151=null;
        Token STRING152=null;
        YAGIParser.var_return var153 =null;


        CommonTree INT151_tree=null;
        CommonTree STRING152_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:172:2: ( INT | STRING | var )
            int alt24=3;
            switch ( input.LA(1) ) {
            case INT:
                {
                alt24=1;
                }
                break;
            case STRING:
                {
                alt24=2;
                }
                break;
            case 10:
                {
                alt24=3;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 24, 0, input);

                throw nvae;

            }

            switch (alt24) {
                case 1 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:172:4: INT
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    INT151=(Token)match(input,INT,FOLLOW_INT_in_value814); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    INT151_tree = 
                    (CommonTree)adaptor.create(INT151)
                    ;
                    adaptor.addChild(root_0, INT151_tree);
                    }

                    }
                    break;
                case 2 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:173:4: STRING
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    STRING152=(Token)match(input,STRING,FOLLOW_STRING_in_value819); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    STRING152_tree = 
                    (CommonTree)adaptor.create(STRING152)
                    ;
                    adaptor.addChild(root_0, STRING152_tree);
                    }

                    }
                    break;
                case 3 :
                    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:174:4: var
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_var_in_value824);
                    var153=var();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, var153.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "value"


    public static class var_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "var"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:177:1: var : '$' ID ;
    public final YAGIParser.var_return var() throws RecognitionException {
        YAGIParser.var_return retval = new YAGIParser.var_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token char_literal154=null;
        Token ID155=null;

        CommonTree char_literal154_tree=null;
        CommonTree ID155_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:178:2: ( '$' ID )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:178:4: '$' ID
            {
            root_0 = (CommonTree)adaptor.nil();


            char_literal154=(Token)match(input,10,FOLLOW_10_in_var835); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal154_tree = 
            (CommonTree)adaptor.create(char_literal154)
            ;
            adaptor.addChild(root_0, char_literal154_tree);
            }

            ID155=(Token)match(input,ID,FOLLOW_ID_in_var837); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID155_tree = 
            (CommonTree)adaptor.create(ID155)
            ;
            adaptor.addChild(root_0, ID155_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "var"


    public static class fluent_decl_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "fluent_decl"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:184:1: fluent_decl : 'fluent' ID ( '[' ']' )* ;
    public final YAGIParser.fluent_decl_return fluent_decl() throws RecognitionException {
        YAGIParser.fluent_decl_return retval = new YAGIParser.fluent_decl_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal156=null;
        Token ID157=null;
        Token char_literal158=null;
        Token char_literal159=null;

        CommonTree string_literal156_tree=null;
        CommonTree ID157_tree=null;
        CommonTree char_literal158_tree=null;
        CommonTree char_literal159_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:185:2: ( 'fluent' ID ( '[' ']' )* )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:185:4: 'fluent' ID ( '[' ']' )*
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal156=(Token)match(input,43,FOLLOW_43_in_fluent_decl852); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal156_tree = 
            (CommonTree)adaptor.create(string_literal156)
            ;
            adaptor.addChild(root_0, string_literal156_tree);
            }

            ID157=(Token)match(input,ID,FOLLOW_ID_in_fluent_decl854); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID157_tree = 
            (CommonTree)adaptor.create(ID157)
            ;
            adaptor.addChild(root_0, ID157_tree);
            }

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:185:16: ( '[' ']' )*
            loop25:
            do {
                int alt25=2;
                int LA25_0 = input.LA(1);

                if ( (LA25_0==25) ) {
                    alt25=1;
                }


                switch (alt25) {
            	case 1 :
            	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:185:17: '[' ']'
            	    {
            	    char_literal158=(Token)match(input,25,FOLLOW_25_in_fluent_decl857); if (state.failed) return retval;
            	    if ( state.backtracking==0 ) {
            	    char_literal158_tree = 
            	    (CommonTree)adaptor.create(char_literal158)
            	    ;
            	    adaptor.addChild(root_0, char_literal158_tree);
            	    }

            	    char_literal159=(Token)match(input,26,FOLLOW_26_in_fluent_decl859); if (state.failed) return retval;
            	    if ( state.backtracking==0 ) {
            	    char_literal159_tree = 
            	    (CommonTree)adaptor.create(char_literal159)
            	    ;
            	    adaptor.addChild(root_0, char_literal159_tree);
            	    }

            	    }
            	    break;

            	default :
            	    break loop25;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "fluent_decl"


    public static class fact_decl_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "fact_decl"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:188:1: fact_decl : 'fact' ID ( '[' ']' )* ;
    public final YAGIParser.fact_decl_return fact_decl() throws RecognitionException {
        YAGIParser.fact_decl_return retval = new YAGIParser.fact_decl_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal160=null;
        Token ID161=null;
        Token char_literal162=null;
        Token char_literal163=null;

        CommonTree string_literal160_tree=null;
        CommonTree ID161_tree=null;
        CommonTree char_literal162_tree=null;
        CommonTree char_literal163_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:189:2: ( 'fact' ID ( '[' ']' )* )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:189:4: 'fact' ID ( '[' ']' )*
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal160=(Token)match(input,41,FOLLOW_41_in_fact_decl873); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal160_tree = 
            (CommonTree)adaptor.create(string_literal160)
            ;
            adaptor.addChild(root_0, string_literal160_tree);
            }

            ID161=(Token)match(input,ID,FOLLOW_ID_in_fact_decl875); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID161_tree = 
            (CommonTree)adaptor.create(ID161)
            ;
            adaptor.addChild(root_0, ID161_tree);
            }

            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:189:14: ( '[' ']' )*
            loop26:
            do {
                int alt26=2;
                int LA26_0 = input.LA(1);

                if ( (LA26_0==25) ) {
                    alt26=1;
                }


                switch (alt26) {
            	case 1 :
            	    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:189:15: '[' ']'
            	    {
            	    char_literal162=(Token)match(input,25,FOLLOW_25_in_fact_decl878); if (state.failed) return retval;
            	    if ( state.backtracking==0 ) {
            	    char_literal162_tree = 
            	    (CommonTree)adaptor.create(char_literal162)
            	    ;
            	    adaptor.addChild(root_0, char_literal162_tree);
            	    }

            	    char_literal163=(Token)match(input,26,FOLLOW_26_in_fact_decl880); if (state.failed) return retval;
            	    if ( state.backtracking==0 ) {
            	    char_literal163_tree = 
            	    (CommonTree)adaptor.create(char_literal163)
            	    ;
            	    adaptor.addChild(root_0, char_literal163_tree);
            	    }

            	    }
            	    break;

            	default :
            	    break loop26;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "fact_decl"


    public static class var_decl_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "var_decl"
    // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:192:1: var_decl : 'local' '$' ID ;
    public final YAGIParser.var_decl_return var_decl() throws RecognitionException {
        YAGIParser.var_decl_return retval = new YAGIParser.var_decl_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        Token string_literal164=null;
        Token char_literal165=null;
        Token ID166=null;

        CommonTree string_literal164_tree=null;
        CommonTree char_literal165_tree=null;
        CommonTree ID166_tree=null;

        try {
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:193:2: ( 'local' '$' ID )
            // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:193:4: 'local' '$' ID
            {
            root_0 = (CommonTree)adaptor.nil();


            string_literal164=(Token)match(input,48,FOLLOW_48_in_var_decl894); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            string_literal164_tree = 
            (CommonTree)adaptor.create(string_literal164)
            ;
            adaptor.addChild(root_0, string_literal164_tree);
            }

            char_literal165=(Token)match(input,10,FOLLOW_10_in_var_decl896); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            char_literal165_tree = 
            (CommonTree)adaptor.create(char_literal165)
            ;
            adaptor.addChild(root_0, char_literal165_tree);
            }

            ID166=(Token)match(input,ID,FOLLOW_ID_in_var_decl898); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID166_tree = 
            (CommonTree)adaptor.create(ID166)
            ;
            adaptor.addChild(root_0, ID166_tree);
            }

            }

            retval.stop = input.LT(-1);


            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "var_decl"

    // $ANTLR start synpred1_YAGI
    public final void synpred1_YAGI_fragment() throws RecognitionException {
        // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:16:8: ( declaration )
        // C:\\Users\\Stavros\\Dropbox\\Acad\\Papers\\2012-AAAI-YAGI\\YAGI.g:16:8: declaration
        {
        pushFollow(FOLLOW_declaration_in_synpred1_YAGI59);
        declaration();

        state._fsp--;
        if (state.failed) return ;

        }

    }
    // $ANTLR end synpred1_YAGI

    // Delegated rules

    public final boolean synpred1_YAGI() {
        state.backtracking++;
        int start = input.mark();
        try {
            synpred1_YAGI_fragment(); // can never throw exception
        } catch (RecognitionException re) {
            System.err.println("impossible: "+re);
        }
        boolean success = !state.failed;
        input.rewind(start);
        state.backtracking--;
        state.failed=false;
        return success;
    }


 

    public static final BitSet FOLLOW_declaration_in_line59 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_block_in_line66 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_fluent_decl_in_declaration78 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_18_in_declaration80 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_fact_decl_in_declaration85 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_18_in_declaration87 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_action_decl_in_declaration92 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_proc_decl_in_declaration98 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_assignment_in_declaration103 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_53_in_proc_decl118 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_ID_in_proc_decl120 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_11_in_proc_decl122 = new BitSet(new long[]{0x0000000000001400L});
    public static final BitSet FOLLOW_varlist_in_proc_decl124 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_12_in_proc_decl126 = new BitSet(new long[]{0x0108508040000020L});
    public static final BitSet FOLLOW_block_in_proc_decl128 = new BitSet(new long[]{0x0000008000000000L});
    public static final BitSet FOLLOW_39_in_proc_decl130 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_statement_in_block144 = new BitSet(new long[]{0x0108500040000022L});
    public static final BitSet FOLLOW_action_exec_in_statement157 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_18_in_statement159 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_pick_in_statement164 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_test_in_statement169 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_18_in_statement171 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_for_loop_in_statement176 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_if_then_else_in_statement181 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_choose_in_statement186 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_action_exec197 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_11_in_action_exec199 = new BitSet(new long[]{0x00000000000014C0L});
    public static final BitSet FOLLOW_arglist_in_action_exec201 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_12_in_action_exec202 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_value_in_arglist218 = new BitSet(new long[]{0x0000000000008002L});
    public static final BitSet FOLLOW_15_in_arglist222 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_value_in_arglist224 = new BitSet(new long[]{0x0000000000008002L});
    public static final BitSet FOLLOW_51_in_pick237 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_var_in_pick239 = new BitSet(new long[]{0x0000200000000000L});
    public static final BitSet FOLLOW_45_in_pick241 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_pick243 = new BitSet(new long[]{0x0080000000000000L});
    public static final BitSet FOLLOW_55_in_pick245 = new BitSet(new long[]{0x0108504040000020L});
    public static final BitSet FOLLOW_block_in_pick247 = new BitSet(new long[]{0x0000004000000000L});
    public static final BitSet FOLLOW_38_in_pick249 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_56_in_test259 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_test261 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_44_in_for_loop271 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_var_in_for_loop273 = new BitSet(new long[]{0x0000800000000000L});
    public static final BitSet FOLLOW_47_in_for_loop275 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_for_loop277 = new BitSet(new long[]{0x0000000080000000L});
    public static final BitSet FOLLOW_31_in_for_loop279 = new BitSet(new long[]{0x0108501040000020L});
    public static final BitSet FOLLOW_block_in_for_loop281 = new BitSet(new long[]{0x0000001000000000L});
    public static final BitSet FOLLOW_36_in_for_loop283 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_46_in_if_then_else295 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_if_then_else297 = new BitSet(new long[]{0x0200000000000000L});
    public static final BitSet FOLLOW_57_in_if_then_else299 = new BitSet(new long[]{0x0108502240000020L});
    public static final BitSet FOLLOW_block_in_if_then_else301 = new BitSet(new long[]{0x0000002200000000L});
    public static final BitSet FOLLOW_33_in_if_then_else304 = new BitSet(new long[]{0x0108502040000020L});
    public static final BitSet FOLLOW_block_in_if_then_else306 = new BitSet(new long[]{0x0000002000000000L});
    public static final BitSet FOLLOW_37_in_if_then_else310 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_30_in_choose320 = new BitSet(new long[]{0x010C500040000020L});
    public static final BitSet FOLLOW_block_in_choose322 = new BitSet(new long[]{0x0004000000000000L});
    public static final BitSet FOLLOW_50_in_choose326 = new BitSet(new long[]{0x010C500840000020L});
    public static final BitSet FOLLOW_block_in_choose328 = new BitSet(new long[]{0x0004000800000000L});
    public static final BitSet FOLLOW_35_in_choose333 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_27_in_action_decl349 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_ID_in_action_decl351 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_11_in_action_decl353 = new BitSet(new long[]{0x0000000000001400L});
    public static final BitSet FOLLOW_varlist_in_action_decl355 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_12_in_action_decl357 = new BitSet(new long[]{0x0050000500000000L});
    public static final BitSet FOLLOW_52_in_action_decl362 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_action_decl364 = new BitSet(new long[]{0x0040000500000000L});
    public static final BitSet FOLLOW_32_in_action_decl371 = new BitSet(new long[]{0x0000500000000420L});
    public static final BitSet FOLLOW_assignment_in_action_decl373 = new BitSet(new long[]{0x0040000400000000L});
    public static final BitSet FOLLOW_54_in_action_decl380 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_valexpr_in_action_decl382 = new BitSet(new long[]{0x0000000400000000L});
    public static final BitSet FOLLOW_34_in_action_decl388 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_var_in_varlist403 = new BitSet(new long[]{0x0000000000008002L});
    public static final BitSet FOLLOW_15_in_varlist407 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_var_in_varlist409 = new BitSet(new long[]{0x0000000000008002L});
    public static final BitSet FOLLOW_assign_in_assignment427 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_18_in_assignment429 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_for_loop_assign_in_assignment434 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_conditional_assign_in_assignment439 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_44_in_for_loop_assign450 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_var_in_for_loop_assign452 = new BitSet(new long[]{0x0000800000000000L});
    public static final BitSet FOLLOW_47_in_for_loop_assign454 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_for_loop_assign456 = new BitSet(new long[]{0x0000000080000000L});
    public static final BitSet FOLLOW_31_in_for_loop_assign458 = new BitSet(new long[]{0x0000500000000420L});
    public static final BitSet FOLLOW_assignment_in_for_loop_assign460 = new BitSet(new long[]{0x0000001000000000L});
    public static final BitSet FOLLOW_36_in_for_loop_assign462 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_46_in_conditional_assign474 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_conditional_assign476 = new BitSet(new long[]{0x0200000000000000L});
    public static final BitSet FOLLOW_57_in_conditional_assign478 = new BitSet(new long[]{0x0000500000000420L});
    public static final BitSet FOLLOW_assignment_in_conditional_assign480 = new BitSet(new long[]{0x0000002200000000L});
    public static final BitSet FOLLOW_33_in_conditional_assign483 = new BitSet(new long[]{0x0000500000000420L});
    public static final BitSet FOLLOW_assignment_in_conditional_assign485 = new BitSet(new long[]{0x0000002000000000L});
    public static final BitSet FOLLOW_37_in_conditional_assign489 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term_in_assign501 = new BitSet(new long[]{0x0000000000224000L});
    public static final BitSet FOLLOW_assign_op_in_assign503 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_assign505 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_var_in_assign510 = new BitSet(new long[]{0x0000000000224000L});
    public static final BitSet FOLLOW_assign_op_in_assign512 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_valexpr_in_assign514 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_atom_in_formula550 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_49_in_formula555 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_11_in_formula557 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_formula559 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_12_in_formula561 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_11_in_formula566 = new BitSet(new long[]{0x0C000400000004E0L});
    public static final BitSet FOLLOW_atom_in_formula568 = new BitSet(new long[]{0x0004000020000000L});
    public static final BitSet FOLLOW_connective_in_formula570 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_formula572 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_12_in_formula574 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_40_in_formula579 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_var_in_formula581 = new BitSet(new long[]{0x0000800000000000L});
    public static final BitSet FOLLOW_47_in_formula583 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_formula585 = new BitSet(new long[]{0x0080000000000000L});
    public static final BitSet FOLLOW_55_in_formula587 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_formula589 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_28_in_formula594 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_var_in_formula596 = new BitSet(new long[]{0x0000800000000000L});
    public static final BitSet FOLLOW_47_in_formula598 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_formula600 = new BitSet(new long[]{0x0080000000000000L});
    public static final BitSet FOLLOW_55_in_formula602 = new BitSet(new long[]{0x0C02050010000CE0L});
    public static final BitSet FOLLOW_formula_in_formula604 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_valexpr_in_atom633 = new BitSet(new long[]{0x0000000001D80200L});
    public static final BitSet FOLLOW_comp_op_in_atom635 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_valexpr_in_atom637 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_setexpr_in_atom642 = new BitSet(new long[]{0x0000000001D80200L});
    public static final BitSet FOLLOW_comp_op_in_atom644 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_atom646 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_value_in_atom651 = new BitSet(new long[]{0x0000800000000000L});
    public static final BitSet FOLLOW_47_in_atom653 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_setexpr_in_atom655 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_atom660 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_setexpr719 = new BitSet(new long[]{0x0000000000012002L});
    public static final BitSet FOLLOW_set_in_setexpr722 = new BitSet(new long[]{0x0800000000000020L});
    public static final BitSet FOLLOW_set_in_setexpr728 = new BitSet(new long[]{0x0000000000012002L});
    public static final BitSet FOLLOW_59_in_set741 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_value_in_set743 = new BitSet(new long[]{0x1000000000008000L});
    public static final BitSet FOLLOW_15_in_set747 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_value_in_set749 = new BitSet(new long[]{0x1000000000008000L});
    public static final BitSet FOLLOW_60_in_set754 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term_in_set759 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_term771 = new BitSet(new long[]{0x0000000002000002L});
    public static final BitSet FOLLOW_25_in_term775 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_value_in_term777 = new BitSet(new long[]{0x0000000004000000L});
    public static final BitSet FOLLOW_26_in_term779 = new BitSet(new long[]{0x0000000002000002L});
    public static final BitSet FOLLOW_value_in_valexpr792 = new BitSet(new long[]{0x0000000000012002L});
    public static final BitSet FOLLOW_set_in_valexpr795 = new BitSet(new long[]{0x00000000000004C0L});
    public static final BitSet FOLLOW_value_in_valexpr801 = new BitSet(new long[]{0x0000000000012002L});
    public static final BitSet FOLLOW_INT_in_value814 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRING_in_value819 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_var_in_value824 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_10_in_var835 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_ID_in_var837 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_43_in_fluent_decl852 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_ID_in_fluent_decl854 = new BitSet(new long[]{0x0000000002000002L});
    public static final BitSet FOLLOW_25_in_fluent_decl857 = new BitSet(new long[]{0x0000000004000000L});
    public static final BitSet FOLLOW_26_in_fluent_decl859 = new BitSet(new long[]{0x0000000002000002L});
    public static final BitSet FOLLOW_41_in_fact_decl873 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_ID_in_fact_decl875 = new BitSet(new long[]{0x0000000002000002L});
    public static final BitSet FOLLOW_25_in_fact_decl878 = new BitSet(new long[]{0x0000000004000000L});
    public static final BitSet FOLLOW_26_in_fact_decl880 = new BitSet(new long[]{0x0000000002000002L});
    public static final BitSet FOLLOW_48_in_var_decl894 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_10_in_var_decl896 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_ID_in_var_decl898 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_declaration_in_synpred1_YAGI59 = new BitSet(new long[]{0x0000000000000002L});

}